home *** CD-ROM | disk | FTP | other *** search
/ Diete, Fitness & Bellezza by Slurpnet / Diete, Fitness & Bellezza by Slurpnet.iso / IE55 / TSNT.CAB / mstask.chm / shared.js < prev    next >
Text File  |  2000-06-21  |  43KB  |  1,090 lines

  1. // Filename: shared.js in Shared.chm
  2. // Version post beta 3 (7)
  3. // version 07.01.99
  4.  
  5. //************************************************ EVENT HANDLING ********************************************
  6. //*******************************************************************************************************************
  7. //  re-directs to the proper event-driven functions.
  8.  
  9. window.onload= loadPage;
  10. document.onclick= onclickTriage;
  11. document.onmouseover= gettingHot;
  12. document.onmouseout= gettingCold;
  13. window.onunload=saveChecklistState;
  14. window.onresize= resizeDiv;
  15.  
  16. //window.onbeforeprint= set_to_print;
  17. //window.onafterprint= reset_form;
  18. //********************************************  USER-DEFINED GLOBAL VARIABLES  ****************************************
  19. //********************************************************************************************************************
  20. //  The images listed below can all be changed by the user.
  21.  
  22. var sPreviousTip= "Argomento precedente";
  23. var sNextTip= "Argomento successivo";
  24. var sExpandTip= "Espandi/Comprimi";
  25. var sPopupTip= "Visualizza definizione";
  26. var sShortcutTip= "";
  27.  
  28. var moniker= "ms-its:";                                         // moniker= ""; for flat files
  29. var sSharedCHM= moniker+"shared.chm::/";
  30.  
  31. //************************************************  RESTORE ADDITION BEGIN  ******************************************* 
  32.  
  33. sCurrentDirectory = ".\\";
  34. //var shortcutCold= sSharedCHM + "shortcutCold.gif";
  35. //var shortcutHot= sSharedCHM + "shortcutHot.gif";
  36. var shortcutCold= sCurrentDirectory + "shortcutCold.gif";
  37. var shortcutHot= sCurrentDirectory + "shortcutHot.gif";    
  38.  
  39. //***********************************************  END RESTORE MODIFICATION  *****************************************
  40.  
  41. var closed = sSharedCHM + "plusCold.gif";                //image used for collapsed item in callExpand()
  42. var closedHot = sSharedCHM + "plusHot.gif";            //hot image used for collapsed item in callExpand()
  43. var expand = sSharedCHM + "minusCold.gif";            //image used for expanded item in callExpand()
  44. var expandHot = sSharedCHM + "minusHot.gif";            //hot image used for expanded item in callExpand()
  45.  
  46. var previousCold= sSharedCHM + "previousCold.gif";
  47. var previousHot= sSharedCHM + "previousHot.gif"; 
  48. var nextCold= sSharedCHM + "nextCold.gif";
  49. var nextHot= sSharedCHM + "nextHot.gif"; 
  50.  
  51. var shortcutCold= sSharedCHM + "shortcutCold.gif";
  52. var shortcutHot= sSharedCHM + "shortcutHot.gif";
  53.  
  54. var popupCold= sSharedCHM + "popupCold.gif";
  55. var popupHot= sSharedCHM + "popupHot.gif";
  56.  
  57. var emptyImg= sSharedCHM + "empty.gif";        //image used for empty expand
  58. var noteImg= sSharedCHM + "note.gif";            //image used for notes
  59. var tipImg= sSharedCHM + "tip.gif";            //image used for tips
  60. var warningImg= sSharedCHM + "warning.gif";        //image used for warnings
  61. var cautionImg= sSharedCHM + "caution.gif";        //image used for cautions
  62. var importantImg= sSharedCHM + "important.gif";        //image used for important notice
  63. var relTopicsImg= sSharedCHM + "rel_top.gif";        //image used for important notice
  64.  
  65. var diagramImg= sSharedCHM + "diagram.gif";        //image used for diagram links
  66.  
  67. var branchImg= sSharedCHM + "elle.gif";
  68. var branchImg_RTL= sSharedCHM + "elle_rtl.gif";
  69.  
  70.  
  71. //********************************************  GLOBAL VARIABLES  ******************************************
  72. //********************************************************************************************************
  73.  
  74. var printing = "FALSE";
  75. var single = "FALSE";
  76. var scroller = "FALSE";
  77. var isRTL= (document.dir=="rtl");
  78. var imgStyleRTL= ""; 
  79.       if (isRTL) imgStyleRTL=" style='filter:flipH' ";
  80.  
  81. var sActX_TDC= "CLASSID='CLSID:333C7BC4-460F-11D0-BC04-0080C7055A83'";        //Tabular Data Control  for  reusable text data
  82. var sSharedReusableTextFile= sSharedCHM + "shared.txt";                                        // common reusable text file
  83. var sSharedReusableTextFileRecord= "para";                                                        //reusable text record
  84.  
  85. var numbers= /\d/g;                //javascript regular expression
  86. var spaces= /\s/g;                //javascript regular expression
  87. var semicolon= /;/g;            //javascript regular expression
  88.  
  89. var isIE5= (navigator.appVersion.indexOf("MSIE 5")>0) || (navigator.appVersion.indexOf("MSIE")>0 && parseInt(navigator.appVersion)> 4);
  90. var isPersistent= false;
  91.  
  92.  
  93. //********************************************  INITIALIZATION  *************************************************
  94. //******************************************************************************************************************
  95.  
  96. //*** loadPage **********************************************************************************************
  97. //  Adds the default image tags and re-usable text to the HTML page.
  98.  
  99. function loadPage(){
  100. isPersistent= (document.all.item("checklist")!=null) && (isIE5);
  101.  
  102.   setPreviousNext();
  103.   resizeDiv();
  104.   if (isPersistent) getChecklistState();
  105.   addReusableText();
  106.   insertImages();
  107. }
  108.  
  109. //****** setPreviousNext  ************************************************************************ ********************************************************************************************* 
  110. // insert previous/next navbar
  111. // called by: <div id="nav">@@HTMLsequenceFile.txt or .lst@@</div>
  112.  
  113. function setPreviousNext(){
  114.  
  115.  
  116.   var oNav = document.all.item("nav");
  117.         if (oNav == null ) return;
  118.   
  119.   var sPreviousALT= sPreviousTip;
  120.   var sNextALT= sNextTip;
  121.   var sHTMLfile= oNav.innerHTML;
  122.  
  123.   var imgPrev= "<IMG SRC='"+previousCold+"' BORDER=0 ALT='"+ sPreviousALT +"' ALIGN='top' "+ imgStyleRTL +">";
  124.   var imgNext= "<IMG SRC='"+nextCold+"' BORDER=0 ALT='"+ sNextALT  + "' ALIGN='top' "+ imgStyleRTL +">";
  125.   
  126.   var previousNextObject= "<OBJECT ID='HTMlist' WIDTH=100 HEIGHT=51 " + sActX_TDC +"><param name='DataURL' value='"
  127.         +sHTMLfile +"'><param name='UseHeader' value=True></OBJECT>";
  128.       
  129.         oNav.innerHTML= "<TABLE WIDTH='100%' STYLE='margin-top:0;' cellspacing=0>"
  130.         + "<TR><TD style='text-align=left; background-color:transparent'><A ID='previousLink' HREF='#' REL='previous' CLASS='navbar'>"
  131.         +imgPrev + "</A></TD><TD width='100%' align='center'></td><TD style='text-align=right; background-color:transparent'><A ID='nextLink' HREF='#' REL='next' CLASS='navbar'>"
  132.         +imgNext+ "</A></TD></TR></TABLE>";
  133.                     
  134.       document.body.innerHTML= document.body.innerHTML +  previousNextObject;
  135.       findPageSeq();
  136.       if (printing == "TRUE") return;
  137.       var  thisLoc= document.location.href +"#";
  138.  
  139.       if (previousLink.href== thisLoc) previousLink.style.display="none";
  140.       else  previousLink.style.display="block";
  141.  
  142.       if (nextLink.href== thisLoc) nextLink.style.display="none";
  143.       else  nextLink.style.display="block";
  144.       
  145. }
  146.  
  147. //****** findPageSeq *********************************************************************************************
  148. // finds this page in the "html sequence list" file (filename.lst) and determines the previous & next pages from the list
  149. // the list is created from a tool named "chumper"
  150.  
  151. function findPageSeq() {
  152.  
  153. var rs= HTMlist.recordset;
  154. var thisLoc= document.location.href;
  155. var iLoc= thisLoc.lastIndexOf("/");
  156.  
  157.     if (iLoc > 0) thisLoc= thisLoc.substring(iLoc+1, thisLoc.length);
  158.     
  159.     
  160.     if (nav.style == "[object]") {
  161.                 nav.style.visibility="hidden";
  162.                 printing = "FALSE";
  163.                 }
  164.         else
  165.             {
  166.                 printing = "TRUE";
  167.                 return;
  168.             }
  169.     
  170.        
  171.     rs.moveFirst();
  172.        
  173.     while (!rs.EOF) {
  174.           if (thisLoc == rs.fields("HTMfiles").value){
  175.               nav.style.visibility="visible"; 
  176.                 rs.MoveNext();
  177.               break;
  178.           }
  179.           previousLink.href=rs.fields("HTMfiles").value;      
  180.           rs.moveNext();
  181.      }
  182.                 
  183.       if (!rs.EOF) nextLink.href=rs.fields("HTMfiles").value;
  184. }
  185.  
  186.  
  187. //******Re-usable text ********************************************************************************************* 
  188. // Inserts the Tabular Data Control (TDC) object at the end of the page 
  189. // Inserts "re-usable text" from the txt file at: <span id="@@CHM_name@@@@index#@@" class="reuse"></span>
  190. // e.g.<span id="printing4" class="reuse"></span> for record#4 in the printing.txt in printing.chm.
  191.  
  192. function addReusableText(){
  193.  
  194. var sharedAdded= false;                    // make sure the object i